﻿
Partial Class DetailKhachSanAssess
    Inherits System.Web.UI.Page
    Public str_style As String = ""
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Session("IDCity") Is Nothing Or Request.QueryString("IDKS") Is Nothing Then
            Response.Redirect("~/index.aspx")
        End If
        If Not IsPostBack Then
            'DetailKhachSan.aspx?IDKS={0}
            Dim khachSan As KhachSan = Nothing
            If Request.QueryString("IDKS") IsNot Nothing Then
                Dim idKS As New Guid(Request.QueryString("IDKS"))
                khachSan = KhachSanServer.GetKhachSanByIDKhachSan(idKS)
                ' Dim strCity As String = KhachSanServer.GetCityNameByIDCity(khachSan.CITY_ID)

                'Dim arrivalDate As Date = Session("ArrivalDate")
                'Dim departureDate As Date = Session("DepartureDate")
                'Dim nDays As Long = DateDiff("d", arrivalDate, departureDate)
                'Dim _Date As Date = DateAdd(DateInterval.Day, +1, Now.Date)
                'Dim strDayWeek As String = String.Format("{0} {1}", Util.GetStrThuTrongTuan(arrivalDate.DayOfWeek), Format("MM/dd/yyyy", arrivalDate))
                'Dim lstItem As New ListItem(nDays, arrivalDate)

                divNameHotel.InnerHtml = khachSan.NAME
                lnkQuayLai.Text = "Khách Sạn tại " + Session("NameCity")
                Dim strURLQuayLai As String = String.Format("~/SearchKhachSan.aspx?ArrivalDate={0}&DepartureDate={1}&CityID={2}&Guests={3}&Rooms={4}", Session("ArrivalDate"), Session("DepartureDate"), Session("IDCity"), Session("Guests"), Session("Rooms"))
                lnkQuayLai.PostBackUrl = strURLQuayLai

                Dim listLoaiPhong As List(Of KhachSan) = KhachSanServer.GetLoaiHotelByIdHotel(idKS)
                lnkDatPhong.PostBackUrl = String.Format("~/DetailKhachSanPut.aspx?IDKS={0}&IDLP={1}", Request.QueryString("IDKS"), listLoaiPhong(0).IDLOAIPHONG)

                divDanhGia.InnerHtml = ""
                Dim listDanhGia As List(Of DanhGia) = DatPhongServer.GetListDanhGiaByIDHotel(idKS)
                Dim ncountDG As Integer = DatPhongServer.GetCountDanhGiaByIDHotel(idKS)
                If ncountDG < Util.GetConfigKey("page_num") Or ncountDG = Util.GetConfigKey("page_num") Then
                    str_style = "style=""display:none;"""
                End If
                For i As Integer = 0 To listDanhGia.Count - 1
                    Dim strHTML As String = ""
                    strHTML &= " <div class='bottom-20 rc-item' style='border-top: 1px solid #ccc; padding-top: 20px;'>"
                    strHTML &= " <div class='bottom-5'><b>" + listDanhGia(i).TIEU_DE + "</b></div>"
                    strHTML &= " <div class='bottom-5 gray small'>"
                    Dim strDate As String = String.Format("{0}/{1}/{2}", listDanhGia(i).CREATED_DATE.Day, listDanhGia(i).CREATED_DATE.Month, listDanhGia(i).CREATED_DATE.Year)
                    strHTML = String.Format(" {0} Đánh giá <b>{1}</b>/10 bởi {2} ngày {3} </div>", strHTML, listDanhGia(i).RATE, listDanhGia(i).FULL_NAME, strDate)
                    strHTML &= " <div class='bottom-5'>" + listDanhGia(i).CONTENT + "</div> </div><div class='clear' style='height:10px;'></div>"

                    divDanhGia.InnerHtml = divDanhGia.InnerHtml + strHTML
                Next

            End If
            'Dim strPathAndQuery As String = HttpContext.Current.Request.Url.PathAndQuery
            'Dim strUrl As String = HttpContext.Current.Request.Url.AbsoluteUri.Replace(strPathAndQuery, "")
            'strUrl = strUrl & khachSan.LINK
        End If
    End Sub

End Class
